POV-Ray : Newsgroups : povray.newusers : object{macro()} fails because union : object{macro()} fails because union Server Time
5 Sep 2024 04:16:24 EDT (-0400)
  object{macro()} fails because union  
From: marabou
Date: 29 Nov 2001 07:13:26
Message: <3c062665@news.povray.org>
hello,

it ain't the first time i use macros, but now i think so.
in my code i make a call to a macro which itself is a loop which calls 
another macro. special is that the first macro-call fails and povray does 
not start render if i use the main-call in an object-construct:
        object{mymacro(xd,yd) rotate y*90}
errormessage:
        Parsing.... ein_fach([...]
        /*[...]
        */
        union   <----ERROR
                [...]no matching } in object, union found instead.
but if i use
        mymacro(xd,yd)
the code is interpreted without errors. (but then i do not know how rotate 
the object in macro).
does anybody know what i did wrong or how i can solve this?
thank for hints.

btw: do not search for macro "mymacro()" in code extract.

code follows (extract):
-----------------------------code---------------------

camera{cam1}

light_source{}

#declare ef_box_br = 0.31;
#declare ef_box_ho = 0.07;
#declare ef_box_ti = 0.4;

//------------------------------------------ein_fach
#macro ein_fach(ix,iy,iz)
/*
        ix, iy, iz:     verschiebung im raum
*/
union{                                  <----here the error is shown

        difference{
                box {}
                box {}
                pigment{color White}
        }//difference

        difference{
                superellipsoid{}
                superellipsoid{}
                pigment{color White}
        }//difference
        translate <ix,iy,iz>
}//union
#end
//------------------------------------------ein_fach

//------------------------------------------fachwand
#macro fachwand(anz_x,anz_y,ix,iy,iz)
#local count_x = 0;
#local count_y = 0;
#while (count_x <= anz_x)
        #while (count_y <= anz_y)
                ein_fach(count_x*ef_box_br+ix,count_y*ef_box_ho+iy,iz)
                #declare count_y = count_y + 1;
        #end
        #declare count_y = 0;
        #declare count_x = count_x + 1;
#end

#end
//------------------------------------------fachwand

object{fachwand(37,35,-5.9,0,5.6)}      <-------------fails

fachwand(37,35,0,0,0)                   <-------------okay

-----------------------------code end-----------------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.